package com.design.state.vending;

public class StateVendingMachineDemo {
    public static void main(String[] args) {
        VendingMachine vendingMachine = new VendingMachine();

        vendingMachine.insertCoin(); // No item available.
        vendingMachine.dispense();   // No item to dispense.

        vendingMachine.setCurrentState(new HasItemState());

        vendingMachine.insertCoin(); // Coin inserted. Item ready for dispense.
        vendingMachine.dispense();   // Dispensing item.

        vendingMachine.insertCoin(); // Coin already inserted.
        vendingMachine.dispense();   // Coin inserted. Item dispensed.
    }
}
